package com.computer.demo.mvc.action;


import com.computer.demo.service.IDemoService;
import com.computer.spring.framework.annotation.BYController;
import com.computer.spring.framework.annotation.BYRequestMapping;
import com.computer.spring.framework.annotation.BYRequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@BYController
@BYRequestMapping("/demo")
public class DemoAction {

//    @BYAutowired
    private IDemoService demoService;

    @BYRequestMapping("/query")
    public void query(HttpServletRequest req, HttpServletResponse resp,
                      @BYRequestParam("name") String name){
        try {
            resp.getWriter().write(demoService.get(name));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
